package com.supreme.threadserver.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import java.util.Optional;
import java.util.function.Consumer;

//@Component
public class BeanConfigUtils implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        BeanDefinition beanDefinition = configurableListableBeanFactory.getBeanDefinition("taskExecutor");
        Optional.of(beanDefinition).ifPresent(new Consumer<BeanDefinition>() {
            @Override
            public void accept(BeanDefinition beanDefinition) {
                System.out.println("beanDefinition: " + beanDefinition);
            }
        });
    }
}
